package org.ycty.deale;

import java.util.ArrayList;
import java.util.List;

import org.ycty.dao.HibernateSessionFactory;
import org.ycty.entity.Swt;

public class GetInfomessage {
	public List getInfo() {
		Swt swt = new Swt();
		List list = HibernateSessionFactory.getSession()
				.createQuery("from Swt").list();
		List list2 = new ArrayList();
		for (int i = 0; i < list.size(); i++) {
			swt = (Swt) list.get(i);
			Swt swt2 = new Swt();
			swt2.setId(swt.getId());
			swt2.setPathname(swt.getPathname());
			swt2.setWebname(swt.getWebname());
			swt2.setWeburl(swt.getWeburl());
			String js = swt.getSwtjs();
			String s = swt.getSwtjs().substring(js.indexOf("\"")+1,
					js.lastIndexOf("\""));
			swt2.setSwtjs(s);
			swt2.setOther(swt.getOther());
			swt2.setBmgs(swt.getBmgs());
			swt2.setKhdm(swt.getKhdm());
			list2.add(swt2);
		}
		return list2;

	}

	public Swt getOne(int id) {
		return (Swt) HibernateSessionFactory.getSession().createQuery(
				"from Swt where id=?").setInteger(0, id).uniqueResult();
	}
}
